package com.leetcode.algorithm.y22.m09.w2;

import java.util.Arrays;

/**
 * 2160. 拆分数位后四位数字的最小和
 * 
 * https://leetcode.cn/problems/minimum-sum-of-four-digit-number-after-splitting-digits/
 * 
 * @author jie.deng
 *
 */
class Question2160Solution02 {

	public int minimumSum(int num) {
		// 各位数字排序
		char[] chars = ("" + num).toCharArray();
		Arrays.sort(chars);
		return 10 * ((chars[0] - '0') + (chars[1] - '0')) + (chars[2] - '0') + (chars[3] - '0');
	}

}